

#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <stack>

#include "common/utils.hpp"

bool compare(TreeNode* lNode, TreeNode* rNode) {
    if (lNode == nullptr && rNode == nullptr) {
        return true;
    } else if (lNode != nullptr && rNode != nullptr) {
        if (lNode->val != rNode->val) {
            return false;
        } else {
            return compare(lNode->left, rNode->right) && compare(lNode->right, rNode->left);
        }
    } else {
        return false;
    }
}

bool isSymmetric(TreeNode* root) {
    if (root == nullptr) return true;

    return compare(root->left, root->right);
}

extern TreeNode* commonRoot;

int main() {
    bool ret = isSymmetric(commonRoot);
    std::cout << "is symmetric: " << ret << "\n";
}